package com.sugon.quartz.corntrigger;

import org.quartz.Trigger;
import static org.quartz.TriggerBuilder.*;
import static org.quartz.CronScheduleBuilder.*;
import static org.quartz.DateBuilder.*;
/**
 * @desc:
 * @author: luoy
 * @date: 2021-12-09 17:32
 */
public class CornTriggerTest {

    public static void main(String[] args) {

    }


    public static  Trigger get1(){
        //建立一个触发器，每隔两分钟，每天上午8点至下午5点之间：
        Trigger trigger =newTrigger()
                .withIdentity("trigger3", "group1")
                .withSchedule(cronSchedule("0 0/2 8-17 * * ?"))
                .forJob("myJob", "group1")
                .build();
        return trigger;
    }

    public static  Trigger get2(){
        Trigger  trigger = newTrigger()
                .withIdentity("trigger3", "group1")
                .withSchedule(cronSchedule("0 0/2 8-17 * * ?")
                        .withMisfireHandlingInstructionFireAndProceed())
                  .forJob("myJob", "group1")
                .build();
        return trigger;
    }
}
